package com.example.stringbufferlogger.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.stringbufferlogger.dto.SubEntityDTO;
import com.example.stringbufferlogger.entity.LogRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LogRecordMapper extends BaseMapper<LogRecord> {

    /**
     * 根据请求 ID 查询日志记录
     * @param requestId 请求 ID
     * @return 日志记录对象
     */
    @Select("SELECT * FROM LOGRECORD WHERE requestid = #{requestId}")
    LogRecord selectLogRecordWithSessionAttributes(String requestId);

    @Select("select distinct SUB_RULE,SUB_TYPE from CP_CONFIG_APIID_POLICYNO where API_ID = #{apiId}")
    SubEntityDTO getSubstr(String apiId);
}
